public with sharing class CloudFilesForceSamples {

public static void getContainerList(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	List<cloudfilesforce.cfcontainer> lst = c.getContainerList();
	system.debug(LoggingLevel.DEBUG,'containers: ' + lst);
}

public static void getCdnContainerList(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	List<cloudfilesforce.cfCdncontainer> lst = c.getCdnContainerList();
	system.debug(LoggingLevel.DEBUG,'containers: ' + lst);
}

public static void getAccountStats(){	
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);	
	Map<string,string> stats = c.getAccountStats();
	system.debug(LoggingLevel.DEBUG,'account stats: ' + stats);
}

public static void getContainerStats(){	
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	Map<string,string> stats = c.getContainerStats('rescueintegrationdemo');
	system.debug(LoggingLevel.DEBUG,'container stats: ' + stats);
}

public static void getCdnContainerInfo(){	
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	Map<string,string> stats = c.getCdnContainerInfo('rescueintegrationdemo');
	system.debug(LoggingLevel.DEBUG,'container info: ' + stats);
}

public static void getObjectsFromContainer(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	list<cloudfilesforce.cfObject> l = c.getObjectsFromContainer('rescueintegrationdemo');
	system.debug('objects: ' + l);	
}

public static void createContainer(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	string con = c.createContainer('test');
	system.debug('container: ' + con);	
}

public static void createCdnContainer(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	string con = c.createCdnContainer('test', 3600, false, '', '');
	system.debug('container: ' + con);	
}

public static void setCdnContainerInfo(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	string con = c.setCdnContainerInfo('test', 3600, true, false);	
	system.debug('container: ' + con);		
}

public static void deleteContainer(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	string con = c.deleteContainer('test');
	system.debug('container: ' + con);	
}

public static void getObjectMetadata(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	list<cloudfilesforce.cfObject> l = c.getObjectsFromContainer('rescueintegrationdemo');
	system.debug('objects: ' + l);
	
	map<string, string> m = c.getObjectMetadata('rescueintegrationdemo','SF_Res_DEMO_slowed.mp4');
	system.debug('object data: ' + m);		
}

public static void setObjectMetadata(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);	
	Map<string, string> nm = new Map<string, string>();
	nm.put('type','video');
	
	string meta = c.setObjectMetadata('rescueintegrationdemo','SF_Res_DEMO_slowed.mp4',nm);
	
	system.debug(logginglevel.debug,'status: ' + meta);	
}

public static void deleteObject(){
	CloudFilesForceSettings__c settings = CloudFilesForceSettings__c.getInstance();
	CloudFilesForce c = new CloudFilesForce(settings.username__c,settings.authkey__c);
	string obj = c.deleteObject('test','info.pdf');
	system.debug('status: ' + obj);		
}

}